:Init
@setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
@pushd %~dp0
@prompt $_
@echo off

if "%1" == "/?" goto Usage
if "%1" == "-?" goto Usage
goto :SetPaths

:Usage
@echo.
@echo Downloads and installs Web Platform Installer (WPI) command line
@echo application.
@echo.
@echo WEBPLATFORMINSTALLER.SETUP
@echo.
@goto :eof

:SetPaths
call %~dp0Paths.Set.bat

:Install
call :WindowsUpdateEnable
md "%~dp0\webpicmd"
echo "Starting WebPI Download" >> "%_LogFile%"
PowerShell -File 'Web.Get' 'http://go.microsoft.com/?linkid=9752821' '%~dp0\webpicmd' 
echo "Finished WebPI Download" >> "%_LogFile%"
call :WindowsUpdateDisable
@goto :End

:WindowsUpdateEnable
@REM "Windows Update Service is required by Web PI. (Call WindowsUpdateDisable when finished.)"
sc config wuauserv start= demand
goto :eof

:WindowsUpdateDisable
@REM "Disables the Windows Update service."
net stop wuauserv
sc config wuauserv start= disabled
goto :eof

:End
@echo Completed.
@popd
exit /b /0
goto :eof
